using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CodeStory.WebControls
{
	public class TemplateColumn : TreeGridColumn
	{
		private ITemplate itemTemplate;

		[DefaultValue((string)null)]
		[PersistenceMode(PersistenceMode.InnerProperty)]
		[Browsable(false)]
		[TemplateContainer(typeof(IDataItemContainer))]
		public virtual ITemplate ItemTemplate {
			get { return this.itemTemplate; }
			set { this.itemTemplate = value; }
		}

		public override void BuildIn(System.Web.UI.WebControls.TableCell cell, bool databound, IDataItemContainer dataItemContainer) {
			if (ItemTemplate != null) {
				ItemTemplate.InstantiateIn(cell);
			}
		}
	}
}